import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'

import ArticleCategoryVue from '@/views/article/ArticleCategory.vue'
import ArticleManageVue from '@/views/article/ArticleManage.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import Userlist from '@/views/user/Userlist.vue'
import jinquList from '@/views/jinqu/jinquList.vue'
import logList from '@/views/log.vue'
import index from '@/views/index/index.vue'
import indexdata from '@/views/index/indexdata.vue'
import indexJinquList from '@/views/index/jinquList.vue'
import indexJinquData from '@/views/index/jinquData.vue'
import indexJindianList from '@/views/index/jindianList.vue'
import indexJindianData from '@/views/index/jindianData.vue'
import indexJiudianList from '@/views/index/jiudianList.vue'
import indexJiudianData from '@/views/index/jiudianData.vue'
import indexXiaochiList from '@/views/index/xiaochiList.vue'
import indexXiaochiData from '@/views/index/xiaochiData.vue'
import userzhong from '@/views/index/user/userzhong.vue'
import userhistory from '@/views/index/user/History.vue'
import userMessage from '@/views/index/user/Message.vue'
import userProfile from '@/views/index/user/Profile.vue'
import userReviews from '@/views/index/user/Reviews.vue'
import adminMessage from '@/views/admin/message.vue'
import adminJindian from '@/views/admin/jindian.vue'
import adminYuyue from '@/views/admin/yuyue.vue'
import adminImage from '@/views/admin/image.vue'
import adminXiaochi from '@/views/admin/xiaochi.vue'
import adminJiudian from '@/views/admin/jiudian.vue'
import adminUserList from '@/views/admin/userList.vue'
import adminDianpu from '@/views/admin/dianpu.vue'
import adminPinlun  from '@/views/admin/pinlun.vue'
import adminYanpiao from '@/views/admin/yanpiao.vue'

import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'

//定义路由关系
const routes = [
    {path: '/', component: index,redirect:'/index', children: [
        { path: '/index', component: indexdata },
        { path: '/indexJinquList', component: indexJinquList },
        { path: '/indexJinquData', component: indexJinquData },
        { path: '/indexJindianList', component: indexJindianList },
        { path: '/indexJindianData', component: indexJindianData },
        { path: '/indexJiudianList', component: indexJiudianList },
        { path: '/indexJiudianData', component: indexJiudianData },
        { path: '/indexXiaochiList', component: indexXiaochiList },
        { path: '/indexXiaochiData', component: indexXiaochiData },
        { path: '/userzhong', component: userzhong, redirect:'/userProfile',children:[
            { path: '/userhistory', component: userhistory },
            { path: '/userMessage', component: userMessage },
            { path: '/userProfile', component: userProfile },
            { path: '/userReviews', component: userReviews },
        ]},
    ]},
    { path: '/login', component: LoginVue },
    {
        path: '/admin', component: LayoutVue,redirect:'/log/list', children: [
            { path: '/log/list', component: logList },
            { path: '/adminMessage', component: adminMessage },
            { path: '/adminJindian', component: adminJindian },
            { path: '/adminYuyue', component: adminYuyue },
            { path: '/adminImage', component: adminImage },
            { path: '/adminJiudian', component: adminJiudian },
            { path: '/adminXiaochi', component: adminXiaochi },
            { path: '/adminUserList', component: adminUserList },
            { path: '/adminDianpu', component: adminDianpu },
            { path: '/adminPinlun', component: adminPinlun },
            { path: '/adminYanpiao', component: adminYanpiao },
            { path: '/article/category', component: ArticleCategoryVue },
            { path: '/article/manage', component: ArticleManageVue },
            { path: '/user/info', component: UserInfoVue },
            { path: '/user/list', component: Userlist },
            { path: '/jinqu/list', component: jinquList },
            { path: '/user/avatar', component: UserAvatarVue },
            { path: '/user/resetPassword', component: UserResetPasswordVue },
        ]
    }
    
    
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
